package lesson02;

/**
 * 线程的属性
 *
 * @author wileda
 * @date 2023/01/05  9:58
 */
public class Demo04 {
    public static void main(String[] args) {
        Thread thread = new Thread(() ->{
            while(true){
                System.out.println("hello thread...");
                try {
                    Thread.sleep(10000);
                } catch (InterruptedException e) {
                    e.printStackTrace();
                }
            }
        },"大圣");
        //启动线程
        thread.start();

        System.out.println("线程Id = " + thread.getId());
        System.out.println("线程名 = " + thread.getName());
        System.out.println("线程状态 = " + thread.getState());
        System.out.println("线程优先级 = " + thread.getPriority());
        System.out.println("线程是否后台 = " + thread.isDaemon());
        System.out.println("是否存活 = " + thread.isAlive());
        System.out.println("是否中断 = " + thread.isInterrupted());
    }
}
